package cmo.neutech.day11.d2;

import java.util.Scanner;

public class TextAccount {
    public static void main(String[] args) {
        Account account = new Account();
        Scanner scanner = new Scanner(System.in);
        while (true){
            System.out.println("1.存钱   2.取钱    3.查看金额");
            int choice = scanner.nextInt();
            if(choice == 1){
                System.out.println("请输入存钱金额");
                double b = scanner.nextDouble();
                account.save(b);
            } else if (choice == 2) {
                System.out.println("请输入取钱金额");
                double b = scanner.nextDouble();
                try {
                    account.pay(b);
                } catch (BNEException e){
                    e.printStackTrace();
                    break;
                }
            } else if (choice == 3) {
                System.out.println("账户余额为：" + account.show());
            }
        }
    }
}
